#include "bga/graphics/Uniform.h"

namespace bga
{

Uniform::Uniform(const std::string& location, int value) : location(location), matrix(NULL)
{
    this->dimension = 1;
    this->intList.push_back(value);
}

Uniform::Uniform(const std::string& location, float value) : location(location), matrix(NULL)
{
    this->dimension = 1;
    this->floatList.push_back(value);
}

Uniform::Uniform(const std::string& location, int value1, int value2) : location(location), matrix(NULL)
{
    this->dimension = 2;
    this->intList.push_back(value1);
    this->intList.push_back(value2);
}

Uniform::Uniform(const std::string& location, float value1, float value2) : location(location), matrix(NULL)
{
    this->dimension = 2;
    this->floatList.push_back(value1);
    this->floatList.push_back(value2);
}

Uniform::Uniform(const std::string& location, int value1, int value2, int value3) : location(location), matrix(NULL)
{
    this->dimension = 3;
    this->intList.push_back(value1);
    this->intList.push_back(value2);
    this->intList.push_back(value3);
}

Uniform::Uniform(const std::string& location, float value1, float value2, float value3) : location(location), matrix(NULL)
{
    this->dimension = 3;
    this->floatList.push_back(value1);
    this->floatList.push_back(value2);
    this->floatList.push_back(value3);
}

Uniform::Uniform(const std::string& location, int value1, int value2, int value3, int value4) : location(location), matrix(NULL)
{
    this->dimension = 4;
    this->intList.push_back(value1);
    this->intList.push_back(value2);
    this->intList.push_back(value3);
    this->intList.push_back(value4);
}

Uniform::Uniform(const std::string& location, float value1, float value2, float value3, float value4) : location(location), matrix(NULL)
{
    this->dimension = 4;
    this->floatList.push_back(value1);
    this->floatList.push_back(value2);
    this->floatList.push_back(value3);
    this->floatList.push_back(value4);
}

Uniform::Uniform(const std::string& location, const float* matrix, unsigned int dimensions) : location(location)
{
    this->dimension = dimensions;
    this->matrix = matrix;
}

void Uniform::setValue(int value)
{
    this->dimension = 1;
    this->intList.clear();
    this->intList.push_back(value);
}

void Uniform::setValue(float value)
{
    this->dimension = 1;
    this->floatList.clear();
    this->floatList.push_back(value);
}

void Uniform::setMatrix(const float* matrix, unsigned int dimensions)
{
    this->dimension = dimensions;
    this->matrix = matrix;
}

std::string Uniform::getName() const
{
    return this->location;
}

Uniform::~Uniform()
{
}

}


